package cn.demo.quartz.domain;

import cn.demo.common.annotation.Excel;
import cn.demo.common.mybatisFlex.MyInsertListener;
import cn.demo.common.mybatisFlex.MyUpdateListener;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.core.constant.SqlOperator;
import com.mybatisflex.core.query.SqlOperators;
import lombok.Data;

import java.util.Date;

/**
 * 定时任务调度日志表 sys_job_log
 *
 * @author ruoyi
 */
@Data
@Table(value = "sys_job_log",onInsert = MyInsertListener.class,onUpdate = MyUpdateListener.class)
public class SysJobLog {
    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @Id
    @Excel(name = "日志序号")
    private String jobLogId;

    /**
     * 任务名称
     */
    @Excel(name = "任务名称")
    private String jobName;

    /**
     * 任务组名
     */
    @Excel(name = "任务组名")
    private String jobGroup;

    /**
     * 调用目标字符串
     */
    @Excel(name = "调用目标字符串")
    private String invokeTarget;

    /**
     * 日志信息
     */
    @Excel(name = "日志信息")
    private String jobMessage;

    /**
     * 执行状态（0正常 1失败）
     */
    @Excel(name = "执行状态", readConverterExp = "0=正常,1=失败")
    private Integer status;

    /**
     * 异常信息
     */
    @Excel(name = "异常信息")
    private String exceptionInfo;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 开始时间
     */
    @Column(ignore = true)
    private Date startTime;

    /**
     * 停止时间
     */
    @Column(ignore = true)
    private Date stopTime;
    
    // 自定义字段的 SQL 操作符
    @JsonIgnore
    public static final SqlOperators operators = SqlOperators.of()
            .set(SysJobLog::getJobName, SqlOperator.LIKE);
}
